#include "windowabout.h"
#include "public.h"

#include <QLabel>
#include <QPushButton>
#include <QVBoxLayout>

WindowAbout::WindowAbout(QWidget *parent)
    : QWidget(parent)
{
    setWindowTitle(tr("关于"));

    // 创建垂直布局
    QVBoxLayout *mainLayout = new QVBoxLayout(this);

    // 软件 logo
    QLabel *logoLabel = new QLabel(this);
    QPixmap logoPixmap(":/icon/logo.png");
    logoLabel->setPixmap(logoPixmap.scaled(64, 64, Qt::KeepAspectRatio));

    logoLabel->setAlignment(Qt::AlignCenter);
    mainLayout->addWidget(logoLabel);

    // 软件名称
    QString softwareName = QString("%1: %2").arg(tr("软件名称")).arg(APPLICATION_NAME);
    QLabel *nameLabel = new QLabel(softwareName, this);
    mainLayout->addWidget(nameLabel);

    // 软件版本
    QString softwareVersion = QString("%1: %2").arg(tr("软件版本")).arg(APPLICATION_VERSION);
    QLabel *versionLabel = new QLabel(softwareVersion, this);
    mainLayout->addWidget(versionLabel);

    // 作者
    QString softwareAuthor = QString("%1: %2").arg(tr("作者")).arg("Eric Ling");
    QLabel *authorLabel = new QLabel(softwareAuthor, this);
    mainLayout->addWidget(authorLabel);

    setLayout(mainLayout);
    setMinimumHeight(160);
    setMinimumWidth(200);
}
